<?php
/**
 * Created by LíJimpéy(：
 * User: jimpey88
 * Date: 2024/3/28
 * Email: < jimpey@qq.com >
 * Project: company-admin-tp6
 */

use think\facade\Route;

Route::group('/', function () {
    Route::get('user', 'login/user');
    Route::get('get_menus', 'permissions/getMenus');
    Route::post('logout', 'login/logout');
    // 文件上传
    Route::post('editor/uploadImg', 'upload/file');
    // 文章管理
    Route::group('article', function () {
        Route::get('/sortList', 'article/sortList');
        Route::get('/articleList', 'article/articleList');
        Route::get('/getArticle/:id', 'article/getArticle');
        Route::post('/addArticle', 'article/create');
        Route::delete('/delArticle/:id', 'article/delArticle');
    });
    // 菜单删除
    Route::delete('permissions/delMenu/:id', 'permissions/delMenu');
    Route::get('permissions/getRolePid/:id', 'permissions/getRolePid');
    Route::delete('permissions/delRole/:id', 'permissions/delRole');

    // 后台用户列表
    Route::group('admin', function() {
        Route::get('/user/list', 'admin/list');
        Route::get('/user/:id', 'admin/read');
        Route::post('/user/register', 'admin/update');
        Route::post('/user/edit', 'admin/update');
        Route::delete('/user/delete/:id', 'admin/delete');
    });
})->middleware([\app\backend_api\middleware\AuthCheck::class,]);